Skip to content

refactor!: use Celestia node fees estimation system - #2822

Merged
tac0turtle merged 13 commits into
mainfrom
hat-yai
Nov 12, 2025
Merged

refactor!: use Celestia node fees estimation system#2822
tac0turtle merged 13 commits into
mainfrom
hat-yai

Conversation

@randygrok

@randygrok randygrok commented Nov 7, 2025

Copy link
Copy Markdown
Contributor

Summary

Remove GasPrice and GasMultiplier from DA interface to use celestia-node's fee estimation.

Closes #2235

Changes

  • Remove GasPrice() and GasMultiplier() methods from DA interface
  • Remove gas configuration fields from DA config and CLI flags

Remove GasPrice and GasMultiplier methods from DA interface for
compatibility with celestia-node. Gas configuration now comes
exclusively from config files with defaults.
@github-actions

github-actions Bot commented Nov 7, 2025

Copy link
Copy Markdown
Contributor

The latest Buf updates on your PR. Results from workflow CI and Release / buf-check (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed⏩ skipped✅ passed✅ passedNov 7, 2025, 11:26 AM

@claude

claude Bot commented Nov 7, 2025

Copy link
Copy Markdown
Contributor

Claude finished @randygrok's task —— View job


Code Review Complete

I've performed a comprehensive review of this PR refactoring the gas price/multiplier handling. Overall, this is a well-executed breaking change that significantly simplifies the DA interface and centralizes gas configuration management. Here are my findings:


Summary

This PR successfully removes GasPrice() and GasMultiplier() methods from the DA interface, moving gas configuration entirely to application config files. This allows celestia-node to handle fee estimation natively, which is the correct architectural decision. The refactoring is thorough and consistent across 39 files with a net reduction of 220 lines of code.


Strengths

  1. Clean Interface Simplification: Removing gas price/multiplier methods from the DA interface is architecturally sound - gas configuration belongs in application config, not in the DA abstraction layer.

  2. Thorough Implementation: All affected components have been properly updated:

    • Core DA interface and implementations (DummyDA, LocalDA)
    • JSON-RPC client/server
    • DA submitter retry logic (simplified significantly)
    • Configuration and CLI flags (properly removed)
    • All test suites updated consistently
    • Documentation (CHANGELOG.md properly updated)
  3. Improved Retry Logic: The new retry policy is cleaner:

    • Removed complex gas price escalation
    • Simplified retryPolicy to focus on attempt/backoff bounds only
    • retryState no longer tracks gas price
    • Better separation of concerns
  4. Good Test Coverage: Tests properly validate the new behavior, especially da_retry_test.go which covers all retry state transitions without gas price logic.

  5. Backward Compatibility Handled: The go.mod replace directives ensure proper local dependency resolution during development.


Issues & Recommendations

1. Gemini's Unused Context Concern

Status: Already addressed in the code.

Gemini Code Assist flagged two functions (getGasMultiplier and initialGasPrice) as having unused ctx parameters. I verified these functions were completely removed in this PR rather than having dangling parameters, so this concern is moot. Good job on the thorough cleanup!


2. Gas Price Still Passed to DA Layer (Low Priority - By Design)

Files:

  • block/internal/submitting/da_submitter.go:414
  • da/jsonrpc/client.go:123-136
  • da/jsonrpc/server.go:64-73
  • core/da/da.go:31-34

The DA interface still includes gasPrice parameters in Submit and SubmitWithOptions:

Submit(ctx context.Context, blobs []Blob, gasPrice float64, namespace []byte) ([]ID, error)
SubmitWithOptions(ctx context.Context, blobs []Blob, gasPrice float64, namespace []byte, options []byte) ([]ID, error)

However, in submitToDA (line 414), the gas price is hardcoded to -1:

res := types.SubmitWithHelpers(submitCtx, s.da, s.logger, marshaled, -1, namespace, mergedOptions)

Analysis: This appears intentional - the -1 acts as a sentinel value indicating "use DA layer's native fee estimation" (i.e., celestia-node's fee system). This is consistent with the PR's goal. However, this could be clarified:

Recommendations:

  • Consider adding a constant like UseNativeFeeEstimation = -1 to make the intent explicit
  • Add a comment at the call site explaining why -1 is passed
  • Future consideration: Could potentially remove gasPrice parameter entirely from DA interface if it's always -1, but this might break compatibility with other DA layers

3. Configuration Validation

File: pkg/config/config.go:156-167

Good to see that GasPrice and GasMultiplier fields were completely removed from DAConfig. The configuration validation is thorough, including namespace validation and lazy mode checks.


4. Mock Generation Consistency ⚠️

Files: block/internal/submitting/da_submitter_mocks_test.go

The mock generation was updated to remove gas price methods. Ensure that:

  • make mock-gen has been run to regenerate all mocks
  • No stale mocks remain in the codebase

Verification needed: Run make mock-gen to ensure all mocks are current.


5. JSON-RPC Client MaxBlobSize Handling

File: da/jsonrpc/client.go:209-234

The client properly accepts and stores maxBlobSize during initialization. The SubmitWithOptions method validates blob sizes before submission (lines 141-162), which is good defensive programming.


6. Test Coverage for New Behavior

Files:

  • block/internal/submitting/da_retry_test.go - Excellent table-driven tests for retry state machine
  • block/internal/submitting/da_submitter_test.go - Updated appropriately
  • Mock tests updated consistently

The test refactoring properly removes gas price/multiplier logic while maintaining coverage of retry behavior, batch sizing, and error handling.


7. Migration Path / Breaking Change Communication ⚠️

File: CHANGELOG.md:18

The changelog entry is present but minimal:

- Remove GasPrice and GasMultiplier from DA interface and configuration to use celestia-node's native fee estimation. ([#2822](https://github.com/evstack/ev-node/pull/2822))

Recommendation: Enhance the changelog to guide users:

### Changed

- **BREAKING:** Remove GasPrice and GasMultiplier from DA interface and configuration to use celestia-node's native fee estimation. ([#2822](https://github.com/evstack/ev-node/pull/2822))
  - Removed CLI flags: `--evnode.da.gas_price`, `--evnode.da.gas_multiplier`
  - Removed config fields: `da.gas_price`, `da.gas_multiplier`
  - Gas fees are now handled natively by the underlying DA layer (e.g., celestia-node)
  - **Migration**: Remove these fields from your configuration files. Fee estimation will now be automatic.

Security Considerations ✅

  1. No Credential Exposure: The refactoring doesn't introduce any security risks related to secrets or credentials.
  2. Input Validation: Namespace validation is properly maintained (validateNamespace functions).
  3. Size Limits: Blob size validation is preserved and correctly enforced before submission.
  4. Concurrency Safety: No new race conditions introduced; mutex usage remains sound.

Performance Considerations ✅

  1. Reduced Complexity: Removing gas price retrieval and escalation logic reduces computational overhead in retry loops.
  2. No Blocking Operations Added: The refactoring doesn't introduce any new blocking calls.
  3. Memory Efficiency: Net reduction of code suggests improved memory footprint.

Code Quality ✅

  1. Error Handling: Consistent and proper throughout the changes.
  2. Logging: Appropriate log levels maintained; gas price logging removed where applicable.
  3. Documentation: Inline comments are clear; function documentation is maintained.
  4. Naming Conventions: Go idioms followed consistently.

CI Status

At review time, CI is still running:

  • Semantic Pull Request: ✅ Passed
  • CI: 🔄 In Progress
  • Buf Check: 🔄 In Progress

Previous reviewer (alpe) noted "CI is failing though" - recommend checking CI logs once complete to address any issues.


Final Verdict

Approval Status: LGTM with minor suggestions

This is a high-quality refactoring that achieves its stated goals:

  • ✅ Removes gas price/multiplier from DA interface
  • ✅ Simplifies retry logic significantly
  • ✅ Updates all affected code paths consistently
  • ✅ Maintains test coverage
  • ✅ Documents breaking changes

Minor Improvements:

  1. Enhance CHANGELOG with migration guidance (low priority)
  2. Consider adding a constant for the -1 sentinel value (optional)
  3. Verify make mock-gen has been run (verification step)
  4. Monitor CI completion to address any failures

Recommendation: This PR is ready to merge once CI passes. The breaking change is well-justified and properly implemented.


@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @randygrok, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refactors the Data Availability (DA) layer's gas configuration mechanism. The primary goal is to simplify the DA interface and ensure compatibility with external systems like celestia-node by centralizing gas price and multiplier settings within application configuration files. This change removes the responsibility of providing gas parameters from the DA interface itself, leading to a more predictable and manageable gas parameter flow throughout the system.

Highlights

  • DA Interface Simplification: The GasPrice() and GasMultiplier() methods have been removed from the core DA interface, streamlining its definition and reducing its responsibilities.
  • Centralized Gas Configuration: Gas-related parameters (GasPrice and GasMultiplier) are now exclusively managed through configuration files, eliminating their dynamic retrieval from the DA layer and ensuring a single source of truth.
  • Broad Codebase Adaptation: All relevant components, including DummyDA, LocalDA, JSON-RPC client/server, the DA Submitter, various applications (evm/single, grpc/single, testapp), and their respective tests, have been updated to reflect this new configuration approach.
  • Dependency Management Updates: Added replace directives in go.mod files across several modules to ensure proper local dependency resolution for core and da packages during development.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request effectively refactors the gas price and multiplier handling by removing them from the DA interface and relying on configuration instead. The changes are consistent and well-implemented across the codebase, simplifying the architecture. I've found a minor area for improvement regarding unused context parameters in the updated functions, which will enhance code cleanliness.

Comment thread block/internal/submitting/da_submitter.go Outdated
Comment thread block/internal/submitting/da_submitter.go Outdated
@randygrok
randygrok marked this pull request as draft November 7, 2025 11:28
@randygrok randygrok changed the title refactor: remove GasPrice and GasMultiplier from DA interface refactor: use Celestia node fees estimation system Nov 7, 2025
@codecov

codecov Bot commented Nov 7, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.30769% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 64.65%. Comparing base (3a9c9ba) to head (0f649e2).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
block/internal/submitting/da_submitter.go 95.23% 1 Missing ⚠️
tools/da-debug/main.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2822      +/-   ##
==========================================
- Coverage   64.79%   64.65%   -0.14%     
==========================================
  Files          81       81              
  Lines        7224     7170      -54     
==========================================
- Hits         4681     4636      -45     
+ Misses       2003     1994       -9     
  Partials      540      540              
Flag Coverage Δ
combined 64.65% <92.30%> (-0.14%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions

github-actions Bot commented Nov 10, 2025

Copy link
Copy Markdown
Contributor

The latest Buf updates on your PR. Results from workflow CI / buf-check (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed⏩ skipped✅ passed✅ passedNov 12, 2025, 7:44 AM

@randygrok
randygrok marked this pull request as ready for review November 11, 2025 09:56

@julienrbrt julienrbrt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK! we should ~~update the changelog~ and make @auricom aware.

@julienrbrt julienrbrt changed the title refactor: use Celestia node fees estimation system refactor!: use Celestia node fees estimation system Nov 11, 2025
julienrbrt
julienrbrt previously approved these changes Nov 11, 2025
tac0turtle
tac0turtle previously approved these changes Nov 11, 2025

@tac0turtle tac0turtle left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@randygrok
randygrok dismissed stale reviews from tac0turtle and julienrbrt via ae47f82 November 11, 2025 16:16
alpe
alpe previously approved these changes Nov 11, 2025

@alpe alpe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes look good 👍
CI is failing though

@randygrok
randygrok added this pull request to the merge queue Nov 12, 2025
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to no response for status checks Nov 12, 2025
@tac0turtle
tac0turtle merged commit 8436bf4 into main Nov 12, 2025
27 of 28 checks passed
@tac0turtle
tac0turtle deleted the hat-yai branch November 12, 2025 11:02
@github-project-automation github-project-automation Bot moved this to Done in Evolve Nov 12, 2025
alpe added a commit that referenced this pull request Nov 12, 2025
* main:
  refactor!: use Celestia node fees estimation system (#2822)
@claude claude Bot mentioned this pull request Nov 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

[Feature Request]: Modify DA submission logic to use Fee estimation logic in Celestia node

4 participants